Repository navigation
Add native Hill dose-response fitting - #1097
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1097 +/- ##
==========================================
+ Coverage 80.12% 80.27% +0.15%
==========================================
Files 55 55
Lines 7571 7635 +64
==========================================
+ Hits 6066 6129 +63
- Misses 1505 1506 +1
🚀 New features to boost your workflow:
|
Member
|
Great! Let me know when you want me to have a look, please. |
Contributor
Author
|
Thanks! It's ready for review whenever you have time. |
Zethson
requested changes
Sep 11, 2026
Zethson
left a comment
Member
There was a problem hiding this comment.
Thanks! I think we're getting there.
Contributor
Author
|
Thanks for the review! I've updated the fitter to store results in AnnData, shortened the documentation and examples, added the API links, and made the integration test use the existing RNG fixture again. I've also added a short assay-response example to the tutorial. |
Member
|
I'll finalize it at the end of this week |
fit_dose_response only used the AnnData as a sink for .uns, so callers with assay tables had to build an empty AnnData. It now takes the tidy table and returns the fits, matching dose_response and evaluate_combinations. A perturbation with too few doses, a constant response or a non-converging fit now warns and gets a NaN row instead of aborting the whole screen. Drop response_type, which only renamed ec50 to ic50, and document that e0 is extrapolated when the reference group is absent from the input.
dose_response now returns a perturbation-by-dose AnnData (group means in X, distance and group-constant obs columns in .obs) instead of a DataFrame, matching PseudobulkSpace.compute. This is a breaking change to the 1.2.0 API. fit_dose_response reads perturbation, dose and response from .obs and writes the fitted response and the per-perturbation Hill parameters as hill_* columns to .obs, so results stay in AnnData without .uns. Assay data works as an AnnData whose .obs holds one row per well.
dose_response now stores the mean expression of adata.X (or layer_key) in X so var matches the input genes; embedding_key only selects the distance space. fit_dose_response takes a response that is an .obs column or a gene and prefixes its .obs columns with it, so several responses can be fit side by side. plot_dose_response replaces hand-written plotting code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
fit_dose_responseandplot_dose_response, which fit and plot a four-parameter Hill curve per perturbation for the distance or any gene, storing EC50 and the curve parameters in.obs.dose_responsenow returns a perturbation-by-dose AnnData with mean expression inXinstead of a DataFrame, which is a breaking change to the 1.2.0 API.Companion tutorial: scverse/pertpy-tutorials#77.